﻿/*
	* Project	: SharePoint Dynamic Forms
	* Version	: 1.0
	* Company	: SharePoint Frontier Software Pvt Ltd. (http://www.sharepointfrontier.com)
	* Author	: Ashok Raja .T (Blog : http://www.ashokraja.me)
	* Licence	: Published under Microsoft Public License (Ms-PL)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFS.SharePoint.DynamicForms.Validation;

namespace SFS.SharePoint.DynamicForms
{
    public class SPDynamicField
    {
        public string InternalName { get; set; }
        public string DisplayName { get; set; }
        public object Value { get; set; }
        public bool IsRequired { get; set; }
        public string FieldType { get; set; }
        public string LastError { get; set; }
        public string DisplayMode { get; set; }
        public string DefaultValue { get; set; }

        private List<SPDynamicField> _FieldCollection = new List<SPDynamicField>();
        public List<SPDynamicField> FieldCollection
        {
            get { return _FieldCollection; }
            set { _FieldCollection = value; }
        }

        private List<SPDynamicFieldValidationRule> _Rules = new List<SPDynamicFieldValidationRule>();
        public List<SPDynamicFieldValidationRule> ValidationRules
        {
            get { return _Rules; }
            set { _Rules = value; }
        }

        public bool IsValid()
        {
            return GenericFieldValidator.IsValid(_Rules, this);
        }



    }
}
